<%-- 
    Document   : createaccount
    Created on : 21 déc. 2013, 13:47:32
    Author     : guillaume
--%>

<%@page import="java.util.HashMap"%>
<%@page import="java.util.ArrayList"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@page import="java.util.Map"%>
<% String firstName="";
String lastName = "";
String email="";
String login ="";
String firstNameError="";
String lastNameError = "";
String emailError="";
String pwdError="";
String confPwdError="";
Map<String,String> c=(Map<String,String>) request.getAttribute("compte");
HttpSession thisSession = (HttpSession) request.getAttribute("thisSession");
   String msgFile = "";
    Map<String,String> waitingFile=(HashMap<String,String>) request.getAttribute("waitingFile");
    if(waitingFile.size()>0){
        msgFile = msgFile + "("+waitingFile.size()+")";
        
    }
String demande="";
ArrayList<String> newMessage = (ArrayList<String>) thisSession.getAttribute("newMessage");
String newMsg = "";
if(newMessage.size()!=0){
    newMsg= newMsg+" ("+newMessage.size()+")";
}    
   ArrayList<String> demandeContact = (ArrayList<String>) thisSession.getAttribute("demandeContact");
   if(demandeContact.size()!=0){
       boolean accept = true;
       int notif = demandeContact.size();
       if(notif!=0){
           demande = " (" + notif+")";
       }
   }
if(c.containsKey("firstName")){
firstName=c.get("firstName");
}
if(c.containsKey("lastName")){
lastName = c.get("lastName");
}
if(c.containsKey("email")){
email=c.get("email");
}
if(c.containsKey("login")){
login =c.get("login");
}
if(c.containsKey("idFirstName")){
firstNameError=c.get("idFirstName");
}
if(c.containsKey("idLastName")){
lastNameError=c.get("idLastName");
}
if(c.containsKey("idEmail")){
emailError=c.get("idEmail");
}
if(c.containsKey("idPwd")){
pwdError=c.get("idPwd");
}
if(c.containsKey("idConfPwd")){
confPwdError=c.get("idConfPwd");
}
%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <link rel="stylesheet" type="text/css" href="css/createacc.css"/>
        <title>Create Account</title>
    </head>
    <body>
        <header>
            <a href="RedirectConnected"><img src="Pictures/logo.png" class="logo" style="float: outside;"></a>
            <div class="zone">
                <div class="zone-right"></div>
                <div class="zone-left"></div>
                <div class="zone-bg">
                    <ul>
                        <li><a href="RedirectConnected"><span>Home <%= newMsg%></span></a></li>
                        <li><a href="NewContact.html"><span>Contact <%= demande%></span></a></li>
                        <li><a href="profile.html"><span>Profile</span></a></li>
                        <li><a href="File.html"><span>File <%= msgFile%></span></a></li>
                        <li class="current"><a href="Administrator.html"><span>Administration</span></a></li>
                        <li><a href="logout.html"><span>Logout</span></a></li>
                    </ul>
                </div>
            </div>
        </header>
        <div class="general">
		<form method="post" action="CreateAccount">
		<label for="idFirstName">First Name:</label><input type="text" name="firstname" id="idFirstName" value="<%=firstName %>"/><em><%=firstNameError %></em><br>
		<label for="idLastName">Last Name:</label><input type="text" name="lastname" id="idLastName" value="<%=lastName %>"/><em><%=lastNameError %></em><br>
                <label for="idEmail">email:</label><input type="text" name="email" id="idEmail" value="<%=email %>"/><em><%=emailError %></em><br>
		<label for="idPwd">Password:</label><input type="password" id="idPwd" name="pwd"/><em><%=pwdError %></em><br>
                <label for="idConfPwd">Confirm Password:</label><input type="password" id="idConfPwd" name="confpwd"/><em><%=confPwdError %></em><br><br>
                <label for="idRight"> Rights:<br>
                Admin
                <input type="radio" name="rights" id="idRight" value="admin"/>
                User
                <input type="radio" name="rights" id="idRight" value="user" />
                </label><br><br>
                
                
		<input type="submit" value="create"/>
		</form>
	</div>
    </body>
</html>
